package odgs.pda.sender;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;

import odgs.message.Message;

public class JoinResponseSender implements SendMessageHandler {
	public JoinResponseSender() {
	}

	@Override
	public void send(Message msg, OutputStream os) {
		System.out.println(msg.getName() + "  sended");
		ByteArrayOutputStream bout = new ByteArrayOutputStream();
		try {
			bout.write((msg.getName() + "\n").getBytes());
			byte[] data = bout.toByteArray();
			os.write(data);
			os.flush();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}
